<template>
	<view class="wrap-menu-info safe-area" :style="'padding-top:' + statusHeight + 'px;'" v-if="userInfo">
		<view class="top-header flex align-center">
			<view class="weath-box" @click="onChangeWeath">
				<view class="weath-info flex align-base">
					<text class="weath f-30">
						{{ userInfo.temp }}°
					</text>
					
					<text class="f-22">
						{{ userInfo.weath }}
					</text>
				</view>
				
				<view class="address flex align-center">
					<view>{{ userInfo.city }}</view>
					
					<image class="arrow" src="/static/images/arrow_right.png" />
				</view>
			</view>
			
			<view class="setting-box flex align-center" @click="onSetting">
				<image class="setting" src="/static/images/setting.png" />
				
				<view>设置</view>
			</view>
			
			<view class="scan-box flex align-center">
				<image class="scan" src="/static/images/scan.png" />
				
				<view>扫一扫</view>
			</view>
		</view>
		
		<view class="wrap-list">
			<block v-for="(item, index) in list" :key="index">
				<view class="item flex align-center just-between">
					<view class="left flex align-center">
						<image class="file" :src="item.file" />
						
						<view class="title">
							{{ item.title }}
						</view>
					</view>
					
					<view class="right flex align-center">
						<image class="arrow" src="/static/images/arrow_right.png" />
					</view>
				</view>
			</block>
			
			<view class="more-btn flex align-center just-center">
				<image class="img" src="/static/images/gdgn.png" />
				
				<view>更多功能</view>
			</view>
		</view>
		
		<weathPopupVue
			:isShow.sync="isShowPopup"
			@onRefresh="$emit('onRefresh')"
		/>
	</view>
</template>

<script>
	import weathPopupVue from "../popup/weathPopup.vue";
	export default {
		components: {
			weathPopupVue
		},
		props: {
			/**
			 * 用户信息
			 */
			userInfo: {
				type: Object,
				default: null,
			},
		},
		data() {
			return {
				statusHeight: uni.getWindowInfo()["statusBarHeight"],
				
				list: [
					{
						title: "我的订单",
						file: "/static/images/dysc.png",
					},
					{
						title: "我的钱包",
						file: "/static/images/wdqb.png",
					},
					{
						title: "观看历史",
						file: "/static/images/gkjl.png",
					},
					{
						title: "抖音创作者中心",
						file: "/static/images/dyczzzx.png",
					},
					{
						title: "未成年模式",
						file: "/static/images/wcnms.png",
					},
					{
						title: "我的客服",
						file: "/static/images/wdkf.png",
					},
					{
						title: "我的二维码",
						file: "/static/images/wdewm.png",
					},
					{
						title: "稍后再看",
						file: "/static/images/shzk.png",
					},
					{
						title: "离线缓存",
						file: "/static/images/lxhc.png",
					},
				],
				
				isShowPopup: false,
			}
		},
		methods: {
			/**
			 * 设置
			 */
			onSetting() {
				uni.navigateTo({
					url: "/pages/mine/setting/setting"
				})
			},
			/**
			 * 修改天气
			 */
			onChangeWeath() {
				this.isShowPopup = true;
			},
		}
	}
</script>

<style lang="scss" scoped>
	.wrap-menu-info {
		width: 100%;
		padding: 0rpx 30rpx;
		box-sizing: border-box;
		overflow: hidden;
		
		.top-header {
			width: 100%;
			height: 45px;
			overflow: hidden;
			gap: 30rpx;
			
			.weath-box {
				flex: 1;
				overflow: hidden;
				
				.weath-info {
					width: 100%;
					overflow: hidden;
					color: #333333;
					
					.weath {
						font-weight: bold;
					}
				}
				
				.address {
					margin-top: 5rpx;
					width: 100%;
					overflow: hidden;
					gap: 5rpx;
					color: #666666;
					font-size: 22rpx;
					
					.arrow {
						width: 20rpx;
						height: 20rpx;
					}
				}
			}
			
			.setting-box {
				padding: 0rpx 20rpx;
				height: 38px;
				background-color: white;
				gap: 20rpx;
				color: #333333;
				font-size: 28rpx;
				border-radius: 20px;
				
				.setting {
					width: 40rpx;
					height: 40rpx;
				}
			}
			
			.scan-box {
				padding: 0rpx 20rpx;
				height: 38px;
				background-color: white;
				gap: 20rpx;
				color: #333333;
				font-size: 28rpx;
				border-radius: 20px;
				
				.scan {
					width: 40rpx;
					height: 40rpx;
				}
			}
		}
		
		.wrap-list {
			margin-top: 20rpx;
			width: 100%;
			background-color: white;
			overflow: hidden;
			border-radius: 20rpx;
			
			.item {
				width: 100%;
				overflow: hidden;
				height: 100rpx;
				padding: 0rpx 20rpx;
				box-sizing: border-box;
				
				.left {
					overflow: hidden;
					gap: 20rpx;
					
					.file {
						width: 40rpx;
						height: 40rpx;
					}
					
					.title {
						color: #333333;
						font-size: 28rpx;
					}
				}
				
				.right {
					gap: 5rpx;
					color: #666666;
					font-size: 24rpx;
					
					.arrow {
						width: 30rpx;
						height: 30rpx;
					}
				}
			}
			
			.more-btn {
				margin: 20rpx 20rpx 40rpx 20rpx;
				flex: 1;
				overflow: hidden;
				height: 60rpx;
				border: 2rpx solid #333333;
				border-radius: 10rpx;
				gap: 15rpx;
				color: #333333;
				font-size: 30rpx;
				
				.img {
					width: 40rpx;
					height: 40rpx;
				}
			}
		}
	}
</style>